Encoding:

POOL32A

000000

rt

shift

ac

EXTR.W

00111001

POOL32Axf

111100

POOL32A

000000

rt

shift

ac

EXTR_R.W

01111001

POOL32Axf

111100

POOL32A

000000

rt

shift

ac

EXTR_RS.W

10111001

POOL32Axf

111100

6

5

5

2

8

6

SPECIAL3

011111

shift

rt

0

000

ac

EXTR.W

00000

EXTR.W

111000

SPECIAL3

011111

shift

rt

0

000

ac

EXTR_R.W

00100

EXTR.W

111000

SPECIAL3

011111

shift

rt

0

000

ac

EXTR_RS.W

00110

EXTR.W

111000

6

5

5

3

2

5

6

Format:

EXTR[_RS].W 

Extract Word Value With Right Shift From Accumulator to GPR

EXTR.W   rt, ac, shift

microMIPSDSP

Extract Word Value With Right Shift From Accumulator to GPR

EXTR_R.W  rt, ac, shift

microMIPSDSP

Extract Word Value With Right Shift From Accumulator to GPR

EXTR_RS.W rt, ac, shift

microMIPSDSP

Extract Word Value With Right Shift From Accumulator to GPR

Purpose:

Extract Word Value With Right Shift From Accumulator to GPR

Extract a word value from a 64-bit accumulator to a GPR with right shift, and with optional rounding or rounding and saturation.

Description:

rt = sign_extend(sat32(round(ac >> shift)))

The value in accumulator ac is shifted right by shift bits with sign extension (arithmetic shift right). The 32 least-significant bits of the shifted value are then sign extended to 64 bits and written to the destination register rts.

The rounding variant of the instruction adds a 1 at the most-significant discarded bit position. The 32 least-significant bits of the rounded result are then sign-extended to 64 bits and written to the destination register.

The rounding and saturating variant of the instruction adds a 1 at the most-significant discarded bit position. If the rounding operation results in an overflow, the shifted value is clamped to the maximum positive Q31 fractional value

(0x7FFFFFFF hexadecimal). The rounded and saturated result is then sign-extended to 64 bits and written to the destination register.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS64 architecture. After the execution of this instruction, ac remains unmodified.

For all variants of the instruction, including EXTR.W, bit 23 of the DSPControl register is set to 1 if either of the rounded or non-rounded calculation results in overflow or saturation.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

EXTR.W:
   temp64..0 = _shiftShortAccRightArithmetic( ac, shift )
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF ) ) then
      DSPControlouflag:23 = 1
   endif
   GPR[rt]63..0 = (temp32)32 || temp32..1
   temp64..0 = temp + 1
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
EXTR_R.W:
   temp64..0 = _shiftShortAccRightArithmetic( ac, shift )
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   temp64..0 = temp + 1
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   GPR[rt]63..0 = (temp32)32 || temp32..1
EXTR_RS.W:
   temp64..0 = _shiftShortAccRightArithmetic( ac, shift )
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   temp64..0 = temp + 1
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      if ( temp64 = 0 ) then
          temp32..1 = 0x7FFFFFFF
      else
          temp32..1 = 0x80000000
      endif
      DSPControlouflag:23 = 1
   endif
   GPR[rt]63..0 = (temp32)32 || temp32..1
function _shiftShortAccRightArithmetic( ac1..0, shift4..0 )
   if ( shift4..0 = 0 ) then
      temp64..0 = ( HI[ac]31..0 || LO[ac]31..0 || 0 )
   else
      temp64..0 = ( (HI[ac]31)shift || HI[ac]31..0 || LO[ac]31..shift-1 )
   endif
   return temp64..0
endfunction _shiftShortAccRightArithmetic

Exceptions:

Reserved Instruction, DSP Disabled